From: <ox-...@us...> - 2003-01-31 19:35:33
|
Update of /cvsroot/sheets/sheets In directory sc8-pr-cvs1:/tmp/cvs-serv19479 Modified Files: Sheets.sheets todo.txt Log Message: Added an extensible toolbar framework (So Language Experts can add new toolbars to the UI) Fixed a bug in crashRecovery that would throw an NPE on recovering lost fragments Index: Sheets.sheets =================================================================== RCS file: /cvsroot/sheets/sheets/Sheets.sheets,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Sheets.sheets 17 Jan 2003 22:42:33 -0000 1.31 --- Sheets.sheets 31 Jan 2003 19:34:42 -0000 1.32 *************** *** 346,349 **** --- 346,350 ---- nkramer:2166 schin:258 + schin:1213 rgs:11528 nkramer:27597 *************** *** 355,358 **** --- 356,360 ---- rgs:13430 rgs:13431 + schin:1214 schin:256 object nkramer:6 *************** *** 25470,25473 **** --- 25472,25478 ---- else setLabel(command.getMenuName(superfluous) + " (" + key.toString() + ")"); + Icon icon = command.getIcon(); + if (icon != null) + setIcon(icon); addActionListener(this); } *************** *** 38467,38475 **** // place any lost objects in a sheet where the user can do what they will // with them. ! private static void Sheets.checkForCrash () { // Copy the transient references vector so that we can create the lost sheet // frame without adding to the original set of transient references. Vector copy = getTransientReferences().toVector(); Fragment[] lostComps = getRootlessTransients(); if (lostComps.length > 0) { --- 38472,38481 ---- // place any lost objects in a sheet where the user can do what they will // with them. ! private static Sheet Sheets.checkForCrash () { // Copy the transient references vector so that we can create the lost sheet // frame without adding to the original set of transient references. Vector copy = getTransientReferences().toVector(); + Sheet lostStuff = null; Fragment[] lostComps = getRootlessTransients(); if (lostComps.length > 0) { *************** *** 38477,38484 **** // Note: causes them to be contained so thatthe removeTransientReference // below doesn't actually delete them. ! Sheet lostStuff ! = new Sheet(State.getObjectDatabase(), "Lost Stuff", "Stuff recovered when Sheets crashed.", lostComps); SentinelMgr.brandNewFragment(lostStuff, Profile.getFavoriteProject()); - Sheets.getRootFrame().addSheet(new SheetFrame(lostStuff)); } --- 38483,38488 ---- // Note: causes them to be contained so thatthe removeTransientReference // below doesn't actually delete them. ! lostStuff = new Sheet(State.getObjectDatabase(), "Lost Stuff", "Stuff recovered when Sheets crashed.", lostComps); SentinelMgr.brandNewFragment(lostStuff, Profile.getFavoriteProject()); } *************** *** 38488,38491 **** --- 38492,38497 ---- removeTransientReference(comp); } + + return lostStuff; } object ram:634 *************** *** 38696,38708 **** // meaningful, since the idiom for invoking a command in Java code // is new FooCommand().checkAndExecute(...) ! public abstract class EditCommand section documentation ram:675 rgs:13922 section exports ram:675 nkramer:750 nkramer:14814 rgs:8366 schin:21 schin:22 nkramer:751 nkramer:15031 --- 38702,38718 ---- // meaningful, since the idiom for invoking a command in Java code // is new FooCommand().checkAndExecute(...) ! public abstract class EditCommand implements ActionListener section documentation ram:675 rgs:13922 section exports ram:675 nkramer:750 + schin:1216 nkramer:14814 rgs:8366 + schin:1218 schin:21 + schin:1219 schin:22 + schin:1217 nkramer:751 nkramer:15031 *************** *** 38718,38721 **** --- 38728,38732 ---- nkramer:29152 nkramer:752 + schin:1215 nkramer:754 object ram:679 *************** *** 54584,54588 **** new CopyFragmentToTempSheet().addToMenu(menu, ignore); } else if (type == VIEW) ! fillViewMenu(menu, true); } object rgs:8316 --- 54595,54599 ---- new CopyFragmentToTempSheet().addToMenu(menu, ignore); } else if (type == VIEW) ! fillViewMenu(menu, false); } object rgs:8316 *************** *** 60841,60844 **** --- 60852,60858 ---- setLabel(command.getMenuName(superfluous) + " (" + key.toString() + ")"); } + Icon icon = command.getIcon(); + if (icon != null) + setIcon(icon); setState(currentlyOn); addItemListener(this); *************** *** 60948,60960 **** type=java section text rgs:11649 ! public void Viewer.fillViewMenu (JPopupMenu menu, boolean includeViewAs) { Vector views = null; ! if (includeViewAs) { ! views = getParent().possibleViewsFor(this); ! String currentView = getView(); ! for (int i = 0; i < views.size(); i++) { ! String view = (String)views.elementAt(i); ! new ShowAs(view).addToMenu(menu, null, view.equals(currentView)); ! } } int viewAsEnd = menu.getComponentCount(); --- 60962,60972 ---- type=java section text rgs:11649 ! public void Viewer.fillViewMenu (JPopupMenu menu, boolean fromControlBlock) { Vector views = null; ! views = getParent().possibleViewsFor(this); ! String currentView = getView(); ! for (int i = 0; i < views.size(); i++) { ! String view = (String)views.elementAt(i); ! new ShowAs(view).addToMenu(menu, null, view.equals(currentView)); } int viewAsEnd = menu.getComponentCount(); *************** *** 60987,60991 **** menu.add(showMenu); } ! if (includeViewAs && views.size() > 0 && menu.getComponentCount() > viewAsEnd) menu.insert(new JPopupMenu.Separator(), viewAsEnd); } --- 60999,61003 ---- menu.add(showMenu); } ! if (views.size() > 0 && menu.getComponentCount() > viewAsEnd) menu.insert(new JPopupMenu.Separator(), viewAsEnd); } *************** *** 67232,67235 **** --- 67244,67248 ---- nkramer:3066 rgs:13431 + schin:1214 object rgs:13627 pkg=org.browsecode.sheets *************** *** 70768,70772 **** // superfluous. public void EditCommand.addToMenu (Container menu, String[] superfluous) { ! menu.add(new SimpleCommandMenuItem(this, superfluous)); } object schin:22 --- 70781,70785 ---- // superfluous. public void EditCommand.addToMenu (Container menu, String[] superfluous) { ! menu.add(createMenuItem(superfluous)); } object schin:22 *************** *** 70777,70781 **** public void EditCommand.addToMenu (Container menu, String[] superfluous, boolean currentlySet) { ! menu.add(new CheckedCommandMenuItem(this, superfluous, currentlySet)); } object schin:23 --- 70790,70794 ---- public void EditCommand.addToMenu (Container menu, String[] superfluous, boolean currentlySet) { ! menu.add(createMenuItem(superfluous, currentlySet)); } object schin:23 *************** *** 81305,81310 **** setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, backwardSet); toolbar = new Toolbar(this); ! getContentPane().add(BorderLayout.NORTH, toolbar); indexTabs = new JTabbedPane(JTabbedPane.BOTTOM); --- 81318,81328 ---- setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, backwardSet); + JPanel toolbarStrip = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0)); toolbar = new Toolbar(this); ! toolbarStrip.add(toolbar); ! JToolBar[] toolbars = LanguageExpert.getAllToolbars(); ! for (int i=0; i<toolbars.length; i++) ! toolbarStrip.add(toolbars[i]); ! getContentPane().add(BorderLayout.NORTH, toolbarStrip); indexTabs = new JTabbedPane(JTabbedPane.BOTTOM); *************** *** 82950,82953 **** --- 82968,83115 ---- super.saveCoreInfo(writer); } + object schin:1213 + pkg=org.browsecode.sheets + type=java + section text schin:1213 + public static JToolBar[] LanguageExpert.getAllToolbars () { + ArrayList toolbars = new ArrayList(); + for (int i = 0; i < allExperts.size(); i++) { + JToolBar toolbar = ((LanguageExpert)allExperts.get(i)).getToolBar(); + if (toolbar != null) + toolbars.add(toolbar); + } + return (JToolBar[])toolbars.toArray(new JToolBar[0]); + } + object schin:1214 + pkg=org.browsecode.sheets + type=java + section text schin:1214 + // A toolbar that will get added to the Sheets interface when this Language Expert is loaded + public JToolBar LanguageExpert.getToolBar() { return null; } + object schin:1215 + pkg=org.browsecode.sheets + type=java + section text schin:1215 + // Convenience function for calling commands via a standard ActionListener interface. + public void EditCommand.actionPerformed(ActionEvent e) { + ViewPanel vp = Sheets.getRootFrame().getVisibleContainer().getEditor(); + Viewer selected = vp.selectedFragment(); + if (selected != null) { + checkAndExecute(vp, selected); + if (Profile.recenterAgressively && selected != null) + vp.recenter(selected, ViewPanel.CLOSEST, 0, selected.baseHeight()); + vp.update(); + } + } + object schin:1216 + pkg=org.browsecode.sheets + type=java + section text schin:1216 + // An icon used to represent this command on buttons and in menus + public Icon EditCommand.getIcon() { return null; } + object schin:1217 + pkg=org.browsecode.sheets + type=java + section text schin:1217 + public JButton EditCommand.createButton (String[] superfluous) { + JButton commandButton = new JButton(getMenuName(superfluous)); + commandButton.addActionListener(this); + Icon icon = getIcon(); + if (icon != null) + commandButton.setIcon(icon); + return commandButton; + } + object schin:1218 + pkg=org.browsecode.sheets + type=java + section text schin:1218 + public JMenuItem EditCommand.createMenuItem (String[] superfluous) { + return new SimpleCommandMenuItem(this, superfluous); + } + object schin:1219 + pkg=org.browsecode.sheets + type=java + section text schin:1219 + public JMenuItem EditCommand.createMenuItem (String[] superfluous, boolean currentlySet) { + return new CheckedCommandMenuItem(this, superfluous, currentlySet); + } + object schin:1221 + pkg=org.browsecode.util + type=java + section text schin:1221 + // Very simple cell renderer that assumes the elements in the list are JComponents + // and asks them to do the rendering for themselves. + public class PassThroughCellRenderer implements ListCellRenderer + section exports schin:1221 + schin:1222 + schin:1223 + object schin:1222 + pkg=org.browsecode.util + type=java + section text schin:1222 + static javax.swing.border.Border PassThroughCellRenderer.noFocusBorder; + object schin:1223 + pkg=org.browsecode.util + type=java + section text schin:1223 + public Component PassThroughCellRenderer.getListCellRendererComponent (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + JComponent comp = (JComponent)value; + + comp.setComponentOrientation(list.getComponentOrientation()); + if (isSelected) { + comp.setBackground(list.getSelectionBackground()); + comp.setForeground(list.getSelectionForeground()); + } + else { + comp.setBackground(list.getBackground()); + comp.setForeground(list.getForeground()); + } + comp.setEnabled(list.isEnabled()); + comp.setFont(list.getFont()); + + if (noFocusBorder == null) + noFocusBorder = new javax.swing.border.EmptyBorder(1, 1, 1, 1); + comp.setBorder(cellHasFocus ? UIManager.getBorder("List.focusCellHighlightBorder") : noFocusBorder); + + return comp; + } + object schin:1224 + pkg=org.browsecode.util + type=java + section text schin:1224 + // Simple class that assumes the component that will register itself with + // the combo box given in the constructor, and redirect all action events + // to the components which were selected. This all works under the assumption + // that all the elements in the combo box are buttons (if they are not, nothing will + // happen). + public class PassThroughComboListener implements ActionListener + section exports schin:1224 + schin:1225 + schin:1226 + schin:1227 + object schin:1225 + pkg=org.browsecode.util + type=java + section text schin:1225 + JComboBox PassThroughComboListener.comboBox; + object schin:1226 + pkg=org.browsecode.util + type=java + section text schin:1226 + public PassThroughComboListener(JComboBox comboBox) { + this.comboBox = comboBox; + comboBox.addActionListener(this); + } + object schin:1227 + pkg=org.browsecode.util + type=java + section text schin:1227 + public void PassThroughComboListener.actionPerformed(ActionEvent e) { + Object selected = comboBox.getSelectedItem(); + if (selected instanceof AbstractButton) { + AbstractButton button = (AbstractButton)selected; + button.doClick(); + } + } object sjc:1 pkg=org.browsecode.sheets.dicer *************** *** 88207,88211 **** scanFilenames(state); initDatabase(state); ! checkForCrash(); loadFiles(state); startOpenRequestServer(state); --- 88369,88373 ---- scanFilenames(state); initDatabase(state); ! Sheet lostStuff = checkForCrash(); loadFiles(state); startOpenRequestServer(state); *************** *** 88227,88230 **** --- 88389,88395 ---- }); + if (lostStuff != null) + Sheets.getRootFrame().addSheet(new SheetFrame(lostStuff)); + if (state.immediateExport) { exportSheets(true); // export all *************** *** 95045,95049 **** panel = ((ContainerFrame)container).getEditor(); else { ! Console.internalError(container + " isn't a ViewPanel or ContainerFrame"); return; } --- 95210,95214 ---- panel = ((ContainerFrame)container).getEditor(); else { ! Console.internalError("Couldn't find container for Edit Command"); return; } *************** *** 95882,95889 **** --- 96047,96058 ---- ram:674 nkramer:750 + schin:1216 nkramer:14814 rgs:8366 + schin:1218 schin:21 + schin:1219 schin:22 + schin:1217 nkramer:751 nkramer:15031 *************** *** 95899,95902 **** --- 96068,96072 ---- nkramer:29152 nkramer:752 + schin:1215 nkramer:754 nkramer:755 *************** *** 96587,96590 **** --- 96757,96761 ---- nkramer:3066 rgs:13431 + schin:1214 rgs:13627 nkramer:1679 *************** *** 96595,96598 **** --- 96766,96770 ---- nkramer:2166 schin:258 + schin:1213 nkramer:27597 nkramer:2167 *************** *** 96780,96783 **** --- 96952,96956 ---- schin:134 rgs:12596 + schin:1220 object nkramer:2465 title=Sorting *************** *** 106835,106838 **** --- 107008,107027 ---- schin:1201 schin:1202 + object schin:1220 + title=ComboBox Util + type=sheet + section text schin:1220 + ComboBox Util + section components schin:1220 + nkramer:2460 + lightWeight:separator + schin:1221 + schin:1222 + schin:1223 + lightWeight:separator + schin:1224 + schin:1225 + schin:1226 + schin:1227 object sjc:6 title=ClickableLabel Index: todo.txt =================================================================== RCS file: /cvsroot/sheets/sheets/todo.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** todo.txt 17 Jan 2003 22:42:39 -0000 1.8 --- todo.txt 31 Jan 2003 19:34:56 -0000 1.9 *************** *** 1,11 **** Fixed in this snapshot so far: ! Fixed the bytecode support so that it handles jar classpaths ! Updated version of bcel.jar ! Fixed import and export of DocDocument fragments to/from the dump file ! Documents now export proper xml headers, and import public references properly. ! Greatly improved performance of deleting large number of fragments ! ! Check-in Todo: ! Add dtds to cvs Currently Working On: --- 1,4 ---- Fixed in this snapshot so far: ! x Currently Working On: *************** *** 20,23 **** --- 13,21 ---- XML-ize this todo list so that it can be rendered on the web page by forrest, and create a sheets mode for editing it. Add a status dialog on deletion of 100+ fragments to show progress + Fix Java lookup on like-named classes in different packages (use the java file header to differentiate) + + Misc Stuff: + New Project dialog should not give a choice to import (likewise, import should have a submenu to choose a project or file) + Problem deleting projects (get an error on retrieving a gc'ed object) release criteria: |